﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DisplayBoardInfo.Server.Entities
{
    public static class Patients
    {
        #region Factory methods

        /// <summary>
        /// Gets all patients.
        /// </summary>
        /// <returns>Collection of all patients.</returns>
        public static IEnumerable<Patient> GetAll()
        {
            List<Patient> result = new List<Patient>();
            Model.DatabaseContextDataContext db = new Model.DatabaseContextDataContext();
            foreach (Model.Patient item in db.Patients)
            {
                result.Add(new Patient(item.ID));
            }

            return result;
        }

        /// <summary>
        /// Gets patient with specyfic PESEL number.
        /// </summary>
        /// <param name="PESEL">PESEL number</param>
        /// <returns>Patient with specyfic PESEL.</returns>
        /// <exception cref="ArgumentException">PESEL number is not valid.</exception>
        /// <exception cref="ArgumentOutOfRange">User with that PESEL does not exist</exception>
        public static Patient GetByID(int ID)
        {
            return new Patient(ID);
        }

        #endregion

        #region Helper methods



        #endregion

        #region Validate methods

        /// <summary>
        /// Checks PESEL number.
        /// </summary>
        /// <param name="PESEL">PESEL number.</param>
        /// <returns>True if number is valid or false otherwise.</returns>
        public static bool IsPESELValid(string PESEL)
        {
            //TODO: Dokończyć walidację PESELu.
            return true;
        }

        #endregion
    }
}
